<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>名字空间模式</title>
</head>
<body>
<script src="file1.js"></script>
<script src="file2.js"></script>
<script>
  console.log(namespace1.name);
  namespace1.foo()

  console.log(namespace2.name);
  namespace2.foo()

  namespace1.name = "james"
  namespace1.foo()

</script>
</body>
</html>